# -*- coding: utf-8 -*-
"""
Created on Mon Aug 20 17:06:43 2012

@author: Tomek
"""


import CPPparse
import sys

        
globalNamespace=CPPparse._Namespace()
configFile="config.txt"
def writeNamespace(n):
    if n["name"]!="":
        print ("NAMESPACE")
        print (n["name"])
    for t in n["namespaces"]:
        if t.isIncluded==False:
            writeNamespace(t)
    for t in n["classes"]:
        if t.isIncluded==False:
            print ("CLASS")
            print (t["name"])
    for t in n["functions"]:
        if t.isIncluded==False and t["isOperator"]==False:
            print ("FUNCTION")
            print (t["name"])
    for t in n["enums"]:
        if t.isIncluded==False:
            print ("ENUM")
            print (t["name"])
    if n["name"]!="":
        print ("ENDNS")


def readParsingFile(fname):
    f=open(fname,"r")
    for x in f.readlines():
        rstr=x
        rstr=rstr.replace("\n","")
    f.close()
    return rstr



globalNamespace=CPPparse.parse(readParsingFile(configFile),1,False)



writeNamespace(globalNamespace)
